home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / amiexpress / source / ae / code / ax3.00 / menusend.c < prev    next >
Encoding:
C/C++ Source or Header  |  1980-01-03  |  2.3 KB  |  123 lines

  1. #include "bbs.h"
  2. /**** totally revised
  3. int MenuSend(char *s)
  4. {
  5.  FILE *fp;
  6.  int stat;
  7.  char c[1000];
  8.  
  9.  if(!(fp= fopen(s,"r"))) {
  10.      UnAvailNotice(s,c);
  11.         return(FAILURE);
  12.     }
  13.  
  14.  
  15.  while(fgets(c,995,fp!=NULL)    {
  16.      c[996]='\0';
  17.      if(c[strlen(c)-1]=='\n')        strcat(c,"\r");
  18.      AEPutStr(c);
  19.  
  20.      if(SCheckInput())    {                  /* CHECK FOR INPUT && CARRIER */
  21.          stat=ReadChar(1L);
  22.             if(stat<0)    {
  23.              if(fp) fclose(fp);         return(NO_CARRIER);
  24.             }
  25.             switch(stat) {
  26.             case '\023': /* Pause */
  27.                 stat=ReadChar(KEYBOARD_TIMEOUT);
  28.                 if(stat<0)    {
  29.                     if(fp) fclose(fp);    return(NO_CARRIER);
  30.                 }
  31.                 break;
  32.             case '\003': /* ^C */
  33.                 AEPutStr("**Break\r\n\r\n");
  34.                 if(fp) fclose(fp);
  35.                 if(AnsiColor)  AEPutStr("");
  36.                 return(SUCCESS);
  37.                 break;
  38.             }
  39.         }
  40.     }
  41.  if(fp) fclose(fp);
  42.  if(AnsiColor)  AEPutStr("");
  43.  if(Whence_The_Logon>=REMOTE_LOGON)    {
  44.      stat=CheckCarrier();
  45.         if(stat==FALSE)        return(NO_CARRIER);
  46.     }
  47.  return(SUCCESS);
  48. }
  49.  
  50. ***/
  51. int MenuSend(char *s)
  52. {
  53. FILE *fp;
  54. int stat;
  55. BOOL checked=FALSE;
  56. char c[1000]; /****  old char c[255],*p; ****/
  57. stat=Restricted(s);
  58. fp=fopen(s,"r");
  59. if(fp==NULL || stat)
  60.     {
  61.     UnAvailNotice(s,c);
  62.     return(FAILURE);
  63.     }
  64. ConPutStr(" p"); /* turn console cursor off */
  65. while(fgets(c,995,fp)!=NULL)
  66.     {
  67.     c[996]='\0'; /**** old c[251]='\0'; ****/
  68.      if(c[0]=='~' && !checked){ fclose(fp); return(mcisend(s)); }
  69.      checked=TRUE;
  70.     if(c[strlen(c)-1]=='\n')
  71.         {
  72.         strcat(c,"\r");
  73.         }
  74.     AEPutStr(c);
  75.     /* CHECK FOR INPUT && CARRIER */
  76.     if(SCheckInput())
  77.         {
  78.         stat=ReadChar(1L);
  79.         if(stat<0)
  80.             {
  81.             fclose(fp);ConPutStr(" p");  /* turn console cursor back on */
  82.  
  83.             return(NO_CARRIER);
  84.             }
  85.         switch(stat)
  86.             {
  87.             case '\023': /* Pause */
  88.                 stat=ReadChar(KEYBOARD_TIMEOUT);
  89.                 if(stat<0)
  90.                     {
  91.                     fclose(fp);
  92.                          ConPutStr(" p");  /* turn console cursor back on */
  93.  
  94.                     return(NO_CARRIER);
  95.                     }
  96.                 break;
  97.             case '\003': /* ^C */
  98.                 AEPutStr("**Break\r\n\r\n");
  99.                 fclose(fp);
  100.                 if(AnsiColor) { AEPutStr(""); }
  101.                    ConPutStr(" p");  /* turn console cursor back on */
  102.  
  103.                 return(FAILURE);
  104.                 break;
  105.             }
  106.         }
  107.     }
  108. fclose(fp);
  109. ConPutStr(" p");  /* turn console cursor back on */
  110.  
  111. if(AnsiColor) { AEPutStr(""); }
  112. if(Whence_The_Logon>=REMOTE_LOGON)
  113.     {
  114.     stat=CheckCarrier();
  115.     if(stat==FALSE)
  116.         {
  117.         return(NO_CARRIER);
  118.         }
  119.     }
  120. return(SUCCESS);
  121. }
  122.  
  123.